package com.example.yucheng.mapper;

import com.example.yucheng.domain.Stock;
import com.example.yucheng.domain.Storage;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StorageMapper {
//    @Select("select * from storage limit #{pageNum}, #{pageSize}")
    List<Storage> getStorageList(int pageNum, int pageSize);

//    @Update("update storage set g_id =#{gId},number=#{number},entry_person=#{entryPerson},remark=#{remark} where id = #{id}")
    void updateStorage(Storage stock);

    @Delete("delete from storage where id = #{id}")
    void deleteStorage(int id);

    @Insert("insert storage set g_id=#{gId},number=#{number},time=NOW(),per=#{per},remark=#{remark},cost_price=#{costPrice},entry_person=#{entryPerson},c_id=#{cId}")
    void addStorage(Storage stock);

    @Select("select * from stock where id=#{gId}")
    Stock findGood(int gId);


    List<Storage> getStorageSortList(int pageNum, int pageSize);

    @Select("select * from storage where id = #{id}")
    Storage findStorageById(int id);

    @Select("select * from storage")
    List<Storage> getAllStorage();
}
